﻿using HZY.Host.Admin.ApplicationServices.Systems;
using HZY.Host.Admin.Models.Dtos.Systems;

namespace HZY.Host.Admin.Controllers.Systems;

[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找", DisplayName = "数据权限")]
public class SysDataAuthorityController(IServiceProvider serviceProvider)
    : AdminControllerBase<SysDataAuthorityService, SysDataAuthority, Guid, SysDataAuthority,
        SysDataAuthorityFormDto>(serviceProvider)
{
    /// <summary>
    /// 根据角色id获取数据权限信息
    /// </summary>
    /// <param name="roleId"></param>
    /// <returns></returns>
    [ActionDescriptor(DisplayName = "获取数据权限信息")]
    [ApiResourceCacheFilter(10)]
    [HttpGet("{roleId?}")]
    public Task<Dictionary<string, object>> GetDataAuthorityByRoleIdAsync([FromRoute] Guid roleId)
    {
        return Service.GetDataAuthorityByRoleIdAsync(roleId);
    }
}